<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    //84.79%
    var repeatedSubstringPattern = function(s) {
        for(let i = 1; i <= s.length/2; i++){
            if(s.length%i == 0){
                let j;
                for(j = 0; j < s.length - i; j = j+i){
                    if(s.slice(j, j+i) != s.slice(j+i, j+i*2))break;
                }
                if(j == s.length - i)return true;
            }
        }
        return false;
    };
    let s = "abab";
    console.log(repeatedSubstringPattern(s));
    
</script>
</html>